#ifndef BASE_CTCOND_H_
#define BASE_CTCOND_H_

#include "ct_noncopyable.h"
#include "ct_mutex.h"
#include "ct_mutex.h"
#include <pthread.h>

class ctCond: private ctNoncopyable
{
        public:
                ctCond()
                {
                        ::pthread_cond_init(&cond_, NULL);
                }
                ~ctCond()
                {
                        ::pthread_cond_destroy(&cond_);
                }
                void broadcast()
                {
                        ::pthread_cond_broadcast(&cond_);
                }
                void signal()
                {
                        ::pthread_cond_signal(&cond_);
                }
                void wait(ctMutex &mutex)
                {
                        ::pthread_cond_wait(&cond_, &mutex.mutex_);
                }
        private:
                pthread_cond_t cond_;
};

#endif //BASE_CTCOND_H_
